package study;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Author 刘伟涛
 * @Date 2023/6/9 11:31
 **/
public class Demo03 {
    public static void main(String[] args) {
        List<User> list = Utils.getUserList();
        /*使用stream流按照User类中id属性值分类*/
        Map<Integer, List<User>> collect = list.stream().collect(Collectors.groupingBy(User::getId));
        System.out.println(collect);
    }
}
